home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / cpkocx17 / anim.bas next >
BASIC Source File  |  1998-07-16  |  2KB  |  82 lines

  1. Attribute VB_Name = "Module2"
  2.  
  3. '
  4. ' Draws a rotating card, spinning 360░
  5. ' around the horizontal axis, centered at x%,y%
  6. ' position on form f.
  7. '
  8. Sub Card_FlipVert(cpk As Cardpack, f As Form, c%, x%, y%)
  9.     Dim yc%, cw%, ch%, h%, hDC%
  10.     
  11.     cw% = cpk.CardWidth
  12.     ch% = cpk.CardHeight
  13.     hDC% = f.hDC
  14.     
  15.     yc% = y%
  16.     
  17.     ' draw card with decreasing height
  18.     For h% = ch% To 0 Step -1
  19.         ' erase external border
  20.         f.Line (x%, yc%)-(x% + cw%, yc% + h%), f.BackColor, B
  21.         
  22.         ' draw shrunken card
  23.         yc% = y% + (ch% - h%) \ 2
  24.         cpk.DrawCard hDC%, c%, x%, yc%, cw%, h%
  25.     Next h%
  26.     
  27.     ' flip card before redrawing
  28.     If c% And FACING_UP Then
  29.         c% = c% - FACING_UP + FACING_DOWN
  30.     Else
  31.         c% = c% + FACING_UP - FACING_DOWN
  32.     End If
  33.     
  34.     ' draw card with increasing height
  35.     For h% = 0 To ch%
  36.         yc% = y% + (ch% - h%) \ 2
  37.         cpk.DrawCard hDC%, c%, x%, yc%, cw%, h%
  38.     Next h%
  39.  
  40. End Sub
  41.  
  42.  
  43.  
  44. '
  45. ' Draws a rotating card, spinning 360░
  46. ' around the vertical axis, centered at x%,y%
  47. ' position on form f.
  48. '
  49. Sub Card_FlipHoriz(cpk As Cardpack, f As Form, c%, x%, y%)
  50.     Dim xc%, cw%, ch%, w%, hDC%
  51.     
  52.     cw% = cpk.CardWidth
  53.     ch% = cpk.CardHeight
  54.     xc% = x%
  55.     hDC% = f.hDC
  56.     
  57.     ' draw card with decreasing width
  58.     For w% = cw% To 0 Step -1
  59.         ' erase external border
  60.         f.Line (xc%, y%)-(xc% + w%, y% + ch%), f.BackColor, B
  61.         
  62.         ' draw shrunken card
  63.         xc% = x% + (cw% - w%) \ 2
  64.         cpk.DrawCard hDC%, c%, xc%, y%, w%, ch%
  65.     Next w%
  66.     
  67.     ' flip card before redrawing
  68.     If c% And FACING_UP Then
  69.         c% = c% - FACING_UP + FACING_DOWN
  70.     Else
  71.         c% = c% + FACING_UP - FACING_DOWN
  72.     End If
  73.     
  74.     ' draw card with increasing width
  75.     For w% = 0 To cw%
  76.         xc% = x + (cw% - w%) \ 2
  77.         cpk.DrawCard hDC%, c%, xc%, y%, w%, ch%
  78.     Next w%
  79.  
  80. End Sub
  81.  
  82.